#pragma once

#include <fstream>
using namespace std;

#include "AnimationProperties.h"

#include "src/TGN.cpp"

namespace TGN
{
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary> 
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public __gc class Form1 : public System::Windows::Forms::Form
	{	
	public:

		Form1(void)
		{
			InitializeComponent();
			dragging = false;
			startX = startY = 0;
			selection.X = -1;
			selection.Y = -1;
			bounds.X = 0;
			bounds.Y = 0;
			bounds.Width = 0;
			bounds.Height = 0;

			zoomed = false;
			zoomLevel = 1;
			origW, origH = 0;

			selectionMade = false;
			needSave = false;
			ctrlDown = false;

			hotx = hoty = 0;

			file = new TGNFile;
			AP = new AnimationProperties;

			currentFile = "New.tgn";

			this->Text = this->Text->Concat("Trygon Editor - ", currentFile);
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::Panel *  ImagePanel;
	private: System::Windows::Forms::PictureBox *  ImageBox;
	private: System::Windows::Forms::ListBox *  FrameList;
	private: System::Windows::Forms::Label *  label1;
	private: System::Windows::Forms::Label *  label2;

	private: System::Windows::Forms::Label *  label3;
	private: System::Windows::Forms::Button *  AddImage;
	private: System::Windows::Forms::MainMenu *  mainMenu1;
	private: System::Windows::Forms::MenuItem *  menuItem1;
	private: System::Windows::Forms::MenuItem *  menuItem2;
	private: System::Windows::Forms::MenuItem *  menuItem3;
	private: System::Windows::Forms::MenuItem *  menuItem4;
	private: System::Windows::Forms::MenuItem *  menuItem5;
	private: System::Windows::Forms::MenuItem *  menuItem6;
	private: System::Windows::Forms::MenuItem *  menuItem7;
	private: System::Windows::Forms::MenuItem *  menuItem8;
	private: System::Windows::Forms::MenuItem *  menuItem9;
	private: System::Windows::Forms::OpenFileDialog *  AddImageDlg;


	bool dragging;
	bool scrolling;
	int startX, startY;
	int scrollX, scrollY, scrollBarX, scrollBarY;
	
	Rectangle selection;
	Rectangle origSelection;

	int hotx, hoty;
	Rectangle bounds;

	AnimationProperties *AP;

	String *currentFile;

	TGNFile *file;

	bool zoomed;
	int zoomLevel;
	int origW, origH;

	bool needSave;
	bool ctrlDown;

	bool selectionMade;
	private: System::ComponentModel::IContainer *  components;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>

	private: System::Windows::Forms::Button *  AddFrame;
	private: System::Windows::Forms::ContextMenu *  FrameContext;



	private: System::Windows::Forms::MenuItem *  ContextAddFrame;
	private: System::Windows::Forms::MenuItem *  ContextDeleteFrame;
	private: System::Windows::Forms::MenuItem *  ContextDeleteAllFrames;
	private: System::Windows::Forms::Button *  AddAni;

	private: System::Windows::Forms::SaveFileDialog *  SaveTGN;
	private: System::Windows::Forms::OpenFileDialog *  LoadTGN;
	private: System::Windows::Forms::ContextMenu *  AniContext;
	private: System::Windows::Forms::MenuItem *  menuItem10;
	private: System::Windows::Forms::MenuItem *  menuItem11;
	private: System::Windows::Forms::MenuItem *  menuItem12;
	private: System::Windows::Forms::Button *  ZoomIn;
	private: System::Windows::Forms::Button *  ZoomOut;
	private: System::Windows::Forms::ColorDialog *  alphaDialog;
	private: System::Windows::Forms::MenuItem *  menuItem14;
	private: System::Windows::Forms::NumericUpDown *  mainID;



	private: System::Windows::Forms::ListBox *  AniList;
	private: System::Windows::Forms::ImageList *  iconList;
	private: System::Windows::Forms::ToolBar *  toolBar1;
	private: System::Windows::Forms::ToolBarButton *  tbNew;
	private: System::Windows::Forms::ToolBarButton *  tbOpen;
	private: System::Windows::Forms::ToolBarButton *  tbSave;
	private: System::Windows::Forms::ToolBarButton *  tbColors;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton1;
private: System::Windows::Forms::ToolBarButton *  toolBarButton2;
private: System::Windows::Forms::ToolBarButton *  tbAbout;
private: System::Windows::Forms::GroupBox *  groupBox1;



private: System::Windows::Forms::NumericUpDown *  frameDelay;
private: System::Windows::Forms::Button *  UpdateFrame;
private: System::Windows::Forms::Button *  Preview;
private: System::Windows::Forms::GroupBox *  groupBox4;
private: System::Windows::Forms::GroupBox *  AniGroupBox;
private: System::Windows::Forms::GroupBox *  FrameGroupBox;
private: System::Windows::Forms::TextBox *  pathName;
private: System::Windows::Forms::Button *  updatePathName;



	private: System::Windows::Forms::MenuItem *  menuItem13;

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = new System::ComponentModel::Container();
			System::Resources::ResourceManager *  resources = new System::Resources::ResourceManager(__typeof(TGN::Form1));
			this->ImagePanel = new System::Windows::Forms::Panel();
			this->ImageBox = new System::Windows::Forms::PictureBox();
			this->FrameList = new System::Windows::Forms::ListBox();
			this->FrameContext = new System::Windows::Forms::ContextMenu();
			this->ContextAddFrame = new System::Windows::Forms::MenuItem();
			this->ContextDeleteFrame = new System::Windows::Forms::MenuItem();
			this->ContextDeleteAllFrames = new System::Windows::Forms::MenuItem();
			this->label1 = new System::Windows::Forms::Label();
			this->label2 = new System::Windows::Forms::Label();
			this->label3 = new System::Windows::Forms::Label();
			this->AddImage = new System::Windows::Forms::Button();
			this->mainMenu1 = new System::Windows::Forms::MainMenu();
			this->menuItem1 = new System::Windows::Forms::MenuItem();
			this->menuItem4 = new System::Windows::Forms::MenuItem();
			this->menuItem5 = new System::Windows::Forms::MenuItem();
			this->menuItem6 = new System::Windows::Forms::MenuItem();
			this->menuItem7 = new System::Windows::Forms::MenuItem();
			this->menuItem8 = new System::Windows::Forms::MenuItem();
			this->menuItem2 = new System::Windows::Forms::MenuItem();
			this->menuItem14 = new System::Windows::Forms::MenuItem();
			this->menuItem3 = new System::Windows::Forms::MenuItem();
			this->menuItem9 = new System::Windows::Forms::MenuItem();
			this->AddImageDlg = new System::Windows::Forms::OpenFileDialog();
			this->AddFrame = new System::Windows::Forms::Button();
			this->AddAni = new System::Windows::Forms::Button();
			this->AniList = new System::Windows::Forms::ListBox();
			this->AniContext = new System::Windows::Forms::ContextMenu();
			this->menuItem10 = new System::Windows::Forms::MenuItem();
			this->menuItem11 = new System::Windows::Forms::MenuItem();
			this->menuItem12 = new System::Windows::Forms::MenuItem();
			this->menuItem13 = new System::Windows::Forms::MenuItem();
			this->SaveTGN = new System::Windows::Forms::SaveFileDialog();
			this->LoadTGN = new System::Windows::Forms::OpenFileDialog();
			this->ZoomIn = new System::Windows::Forms::Button();
			this->ZoomOut = new System::Windows::Forms::Button();
			this->alphaDialog = new System::Windows::Forms::ColorDialog();
			this->mainID = new System::Windows::Forms::NumericUpDown();
			this->iconList = new System::Windows::Forms::ImageList(this->components);
			this->toolBar1 = new System::Windows::Forms::ToolBar();
			this->tbNew = new System::Windows::Forms::ToolBarButton();
			this->tbOpen = new System::Windows::Forms::ToolBarButton();
			this->tbSave = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton1 = new System::Windows::Forms::ToolBarButton();
			this->tbColors = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton2 = new System::Windows::Forms::ToolBarButton();
			this->tbAbout = new System::Windows::Forms::ToolBarButton();
			this->groupBox1 = new System::Windows::Forms::GroupBox();
			this->updatePathName = new System::Windows::Forms::Button();
			this->pathName = new System::Windows::Forms::TextBox();
			this->AniGroupBox = new System::Windows::Forms::GroupBox();
			this->Preview = new System::Windows::Forms::Button();
			this->FrameGroupBox = new System::Windows::Forms::GroupBox();
			this->UpdateFrame = new System::Windows::Forms::Button();
			this->groupBox4 = new System::Windows::Forms::GroupBox();
			this->frameDelay = new System::Windows::Forms::NumericUpDown();
			this->ImagePanel->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->mainID))->BeginInit();
			this->groupBox1->SuspendLayout();
			this->AniGroupBox->SuspendLayout();
			this->FrameGroupBox->SuspendLayout();
			this->groupBox4->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->frameDelay))->BeginInit();
			this->SuspendLayout();
			// 
			// ImagePanel
			// 
			this->ImagePanel->Anchor = (System::Windows::Forms::AnchorStyles)(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
				| System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right);
			this->ImagePanel->AutoScroll = true;
			this->ImagePanel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
			this->ImagePanel->Controls->Add(this->ImageBox);
			this->ImagePanel->Location = System::Drawing::Point(8, 24);
			this->ImagePanel->Name = S"ImagePanel";
			this->ImagePanel->Size = System::Drawing::Size(456, 416);
			this->ImagePanel->TabIndex = 0;
			this->ImagePanel->MouseHover += new System::EventHandler(this, ImagePanel_MouseHover);
			// 
			// ImageBox
			// 
			this->ImageBox->Cursor = System::Windows::Forms::Cursors::Cross;
			this->ImageBox->Location = System::Drawing::Point(0, 0);
			this->ImageBox->Name = S"ImageBox";
			this->ImageBox->Size = System::Drawing::Size(344, 312);
			this->ImageBox->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
			this->ImageBox->TabIndex = 0;
			this->ImageBox->TabStop = false;
			this->ImageBox->Paint += new System::Windows::Forms::PaintEventHandler(this, ImageBox_Paint);
			this->ImageBox->MouseUp += new System::Windows::Forms::MouseEventHandler(this, ImageBox_MouseUp);
			this->ImageBox->MouseMove += new System::Windows::Forms::MouseEventHandler(this, ImageBox_MouseMove);
			this->ImageBox->MouseDown += new System::Windows::Forms::MouseEventHandler(this, ImageBox_MouseDown);
			// 
			// FrameList
			// 
			this->FrameList->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom);
			this->FrameList->ContextMenu = this->FrameContext;
			this->FrameList->ItemHeight = 16;
			this->FrameList->Location = System::Drawing::Point(8, 24);
			this->FrameList->Name = S"FrameList";
			this->FrameList->Size = System::Drawing::Size(120, 356);
			this->FrameList->TabIndex = 1;
			this->FrameList->MouseDown += new System::Windows::Forms::MouseEventHandler(this, FrameList_MouseDown);
			this->FrameList->SelectedIndexChanged += new System::EventHandler(this, FrameList_SelectedIndexChanged);
			// 
			// FrameContext
			// 
			System::Windows::Forms::MenuItem* __mcTemp__1[] = new System::Windows::Forms::MenuItem*[3];
			__mcTemp__1[0] = this->ContextAddFrame;
			__mcTemp__1[1] = this->ContextDeleteFrame;
			__mcTemp__1[2] = this->ContextDeleteAllFrames;
			this->FrameContext->MenuItems->AddRange(__mcTemp__1);
			// 
			// ContextAddFrame
			// 
			this->ContextAddFrame->Index = 0;
			this->ContextAddFrame->Text = S"Add Frame";
			this->ContextAddFrame->Click += new System::EventHandler(this, ContextAddFrame_Click);
			// 
			// ContextDeleteFrame
			// 
			this->ContextDeleteFrame->Index = 1;
			this->ContextDeleteFrame->Text = S"Delete Selected Frame";
			this->ContextDeleteFrame->Click += new System::EventHandler(this, ContextDeleteFrame_Click);
			// 
			// ContextDeleteAllFrames
			// 
			this->ContextDeleteAllFrames->Index = 2;
			this->ContextDeleteAllFrames->Text = S"Delete All Frames";
			this->ContextDeleteAllFrames->Click += new System::EventHandler(this, ContextDeleteAllFrames_Click);
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(40, 0);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(112, 16);
			this->label1->TabIndex = 2;
			this->label1->Text = S"Image";
			// 
			// label2
			// 
			this->label2->Location = System::Drawing::Point(488, 0);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(96, 16);
			this->label2->TabIndex = 3;
			this->label2->Text = S"Frames";
			// 
			// label3
			// 
			this->label3->Location = System::Drawing::Point(632, 0);
			this->label3->Name = S"label3";
			this->label3->Size = System::Drawing::Size(80, 16);
			this->label3->TabIndex = 5;
			this->label3->Text = S"Animations";
			// 
			// AddImage
			// 
			this->AddImage->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left);
			this->AddImage->Location = System::Drawing::Point(80, 448);
			this->AddImage->Name = S"AddImage";
			this->AddImage->Size = System::Drawing::Size(120, 24);
			this->AddImage->TabIndex = 6;
			this->AddImage->Text = S"Load Image";
			this->AddImage->Click += new System::EventHandler(this, AddImage_Click);
			// 
			// mainMenu1
			// 
			System::Windows::Forms::MenuItem* __mcTemp__2[] = new System::Windows::Forms::MenuItem*[3];
			__mcTemp__2[0] = this->menuItem1;
			__mcTemp__2[1] = this->menuItem2;
			__mcTemp__2[2] = this->menuItem3;
			this->mainMenu1->MenuItems->AddRange(__mcTemp__2);
			// 
			// menuItem1
			// 
			this->menuItem1->Index = 0;
			System::Windows::Forms::MenuItem* __mcTemp__3[] = new System::Windows::Forms::MenuItem*[5];
			__mcTemp__3[0] = this->menuItem4;
			__mcTemp__3[1] = this->menuItem5;
			__mcTemp__3[2] = this->menuItem6;
			__mcTemp__3[3] = this->menuItem7;
			__mcTemp__3[4] = this->menuItem8;
			this->menuItem1->MenuItems->AddRange(__mcTemp__3);
			this->menuItem1->Text = S"File";
			// 
			// menuItem4
			// 
			this->menuItem4->Index = 0;
			this->menuItem4->Shortcut = System::Windows::Forms::Shortcut::CtrlN;
			this->menuItem4->Text = S"New";
			this->menuItem4->Click += new System::EventHandler(this, menuItem4_Click);
			// 
			// menuItem5
			// 
			this->menuItem5->Index = 1;
			this->menuItem5->Shortcut = System::Windows::Forms::Shortcut::CtrlS;
			this->menuItem5->Text = S"Save";
			this->menuItem5->Click += new System::EventHandler(this, menuItem5_Click);
			// 
			// menuItem6
			// 
			this->menuItem6->Index = 2;
			this->menuItem6->Text = S"Save As";
			this->menuItem6->Click += new System::EventHandler(this, menuItem6_Click);
			// 
			// menuItem7
			// 
			this->menuItem7->Index = 3;
			this->menuItem7->Text = S"Open";
			this->menuItem7->Click += new System::EventHandler(this, menuItem7_Click);
			// 
			// menuItem8
			// 
			this->menuItem8->Index = 4;
			this->menuItem8->Text = S"Exit";
			this->menuItem8->Click += new System::EventHandler(this, menuItem8_Click);
			// 
			// menuItem2
			// 
			this->menuItem2->Index = 1;
			System::Windows::Forms::MenuItem* __mcTemp__4[] = new System::Windows::Forms::MenuItem*[1];
			__mcTemp__4[0] = this->menuItem14;
			this->menuItem2->MenuItems->AddRange(__mcTemp__4);
			this->menuItem2->Text = S"Edit";
			// 
			// menuItem14
			// 
			this->menuItem14->Index = 0;
			this->menuItem14->Text = S"Define Alpha";
			this->menuItem14->Click += new System::EventHandler(this, menuItem14_Click);
			// 
			// menuItem3
			// 
			this->menuItem3->Index = 2;
			System::Windows::Forms::MenuItem* __mcTemp__5[] = new System::Windows::Forms::MenuItem*[1];
			__mcTemp__5[0] = this->menuItem9;
			this->menuItem3->MenuItems->AddRange(__mcTemp__5);
			this->menuItem3->Text = S"Help";
			// 
			// menuItem9
			// 
			this->menuItem9->Index = 0;
			this->menuItem9->Text = S"About";
			this->menuItem9->Click += new System::EventHandler(this, menuItem9_Click);
			// 
			// AddImageDlg
			// 
			this->AddImageDlg->Filter = S"Bitmaps|*.bmp|Pngs|*.png";
			this->AddImageDlg->FilterIndex = 2;
			this->AddImageDlg->Title = S"Load Trygon";
			// 
			// AddFrame
			// 
			this->AddFrame->Anchor = System::Windows::Forms::AnchorStyles::Bottom;
			this->AddFrame->Enabled = false;
			this->AddFrame->Location = System::Drawing::Point(8, 393);
			this->AddFrame->Name = S"AddFrame";
			this->AddFrame->Size = System::Drawing::Size(120, 24);
			this->AddFrame->TabIndex = 7;
			this->AddFrame->Text = S"Add Frame";
			this->AddFrame->Click += new System::EventHandler(this, AddFrame_Click);
			// 
			// AddAni
			// 
			this->AddAni->Anchor = System::Windows::Forms::AnchorStyles::Bottom;
			this->AddAni->Location = System::Drawing::Point(8, 449);
			this->AddAni->Name = S"AddAni";
			this->AddAni->Size = System::Drawing::Size(120, 24);
			this->AddAni->TabIndex = 8;
			this->AddAni->Text = S"Add Animation";
			this->AddAni->Click += new System::EventHandler(this, AddAni_Click);
			// 
			// AniList
			// 
			this->AniList->AllowDrop = true;
			this->AniList->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom);
			this->AniList->ContextMenu = this->AniContext;
			this->AniList->ItemHeight = 16;
			this->AniList->Location = System::Drawing::Point(8, 24);
			this->AniList->Name = S"AniList";
			this->AniList->Size = System::Drawing::Size(120, 420);
			this->AniList->TabIndex = 9;
			this->AniList->MouseDown += new System::Windows::Forms::MouseEventHandler(this, AniList_MouseDown);
			this->AniList->SelectedIndexChanged += new System::EventHandler(this, AniList_SelectedIndexChanged);
			// 
			// AniContext
			// 
			System::Windows::Forms::MenuItem* __mcTemp__6[] = new System::Windows::Forms::MenuItem*[4];
			__mcTemp__6[0] = this->menuItem10;
			__mcTemp__6[1] = this->menuItem11;
			__mcTemp__6[2] = this->menuItem12;
			__mcTemp__6[3] = this->menuItem13;
			this->AniContext->MenuItems->AddRange(__mcTemp__6);
			// 
			// menuItem10
			// 
			this->menuItem10->Index = 0;
			this->menuItem10->Text = S"Add Animation";
			this->menuItem10->Click += new System::EventHandler(this, menuItem10_Click);
			// 
			// menuItem11
			// 
			this->menuItem11->Index = 1;
			this->menuItem11->Text = S"Delete Selected";
			this->menuItem11->Click += new System::EventHandler(this, menuItem11_Click);
			// 
			// menuItem12
			// 
			this->menuItem12->Index = 2;
			this->menuItem12->Text = S"Delete All";
			this->menuItem12->Click += new System::EventHandler(this, menuItem12_Click);
			// 
			// menuItem13
			// 
			this->menuItem13->Index = 3;
			this->menuItem13->Text = S"Edit Selected";
			this->menuItem13->Click += new System::EventHandler(this, menuItem13_Click);
			// 
			// SaveTGN
			// 
			this->SaveTGN->Filter = S"Trygon File|*.tgn";
			this->SaveTGN->Title = S"Save Trygon File";
			// 
			// LoadTGN
			// 
			this->LoadTGN->Filter = S"Trygon File|*.tgn";
			// 
			// ZoomIn
			// 
			this->ZoomIn->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left);
			this->ZoomIn->Location = System::Drawing::Point(208, 448);
			this->ZoomIn->Name = S"ZoomIn";
			this->ZoomIn->Size = System::Drawing::Size(120, 24);
			this->ZoomIn->TabIndex = 10;
			this->ZoomIn->Text = S"Zoom In";
			this->ZoomIn->Click += new System::EventHandler(this, ZoomIn_Click);
			// 
			// ZoomOut
			// 
			this->ZoomOut->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left);
			this->ZoomOut->Location = System::Drawing::Point(336, 448);
			this->ZoomOut->Name = S"ZoomOut";
			this->ZoomOut->Size = System::Drawing::Size(120, 24);
			this->ZoomOut->TabIndex = 11;
			this->ZoomOut->Text = S"Zoom Out";
			this->ZoomOut->Click += new System::EventHandler(this, ZoomOut_Click);
			// 
			// mainID
			// 
			this->mainID->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left);
			this->mainID->Location = System::Drawing::Point(8, 448);
			this->mainID->Name = S"mainID";
			this->mainID->Size = System::Drawing::Size(64, 22);
			this->mainID->TabIndex = 12;
			// 
			// iconList
			// 
			this->iconList->ImageSize = System::Drawing::Size(16, 16);
			this->iconList->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer *  >(resources->GetObject(S"iconList.ImageStream")));
			this->iconList->TransparentColor = System::Drawing::Color::Transparent;
			// 
			// toolBar1
			// 
			this->toolBar1->Appearance = System::Windows::Forms::ToolBarAppearance::Flat;
			System::Windows::Forms::ToolBarButton* __mcTemp__7[] = new System::Windows::Forms::ToolBarButton*[7];
			__mcTemp__7[0] = this->tbNew;
			__mcTemp__7[1] = this->tbOpen;
			__mcTemp__7[2] = this->tbSave;
			__mcTemp__7[3] = this->toolBarButton1;
			__mcTemp__7[4] = this->tbColors;
			__mcTemp__7[5] = this->toolBarButton2;
			__mcTemp__7[6] = this->tbAbout;
			this->toolBar1->Buttons->AddRange(__mcTemp__7);
			this->toolBar1->DropDownArrows = true;
			this->toolBar1->ImageList = this->iconList;
			this->toolBar1->Location = System::Drawing::Point(0, 0);
			this->toolBar1->Name = S"toolBar1";
			this->toolBar1->ShowToolTips = true;
			this->toolBar1->Size = System::Drawing::Size(794, 28);
			this->toolBar1->TabIndex = 13;
			this->toolBar1->ButtonClick += new System::Windows::Forms::ToolBarButtonClickEventHandler(this, toolBar1_ButtonClick);
			// 
			// tbNew
			// 
			this->tbNew->ImageIndex = 1;
			this->tbNew->ToolTipText = S"Make a new Trygon";
			// 
			// tbOpen
			// 
			this->tbOpen->ImageIndex = 2;
			this->tbOpen->ToolTipText = S"Open a Saved Trygon";
			// 
			// tbSave
			// 
			this->tbSave->ImageIndex = 4;
			this->tbSave->ToolTipText = S"Save this Trygon";
			// 
			// toolBarButton1
			// 
			this->toolBarButton1->Style = System::Windows::Forms::ToolBarButtonStyle::Separator;
			// 
			// tbColors
			// 
			this->tbColors->ImageIndex = 3;
			this->tbColors->ToolTipText = S"Change the alpha color";
			// 
			// toolBarButton2
			// 
			this->toolBarButton2->Style = System::Windows::Forms::ToolBarButtonStyle::Separator;
			// 
			// tbAbout
			// 
			this->tbAbout->ImageIndex = 0;
			// 
			// groupBox1
			// 
			this->groupBox1->Anchor = (System::Windows::Forms::AnchorStyles)(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
				| System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right);
			this->groupBox1->Controls->Add(this->updatePathName);
			this->groupBox1->Controls->Add(this->pathName);
			this->groupBox1->Controls->Add(this->ZoomOut);
			this->groupBox1->Controls->Add(this->AddImage);
			this->groupBox1->Controls->Add(this->ZoomIn);
			this->groupBox1->Controls->Add(this->mainID);
			this->groupBox1->Controls->Add(this->ImagePanel);
			this->groupBox1->Location = System::Drawing::Point(8, 24);
			this->groupBox1->Name = S"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(472, 512);
			this->groupBox1->TabIndex = 14;
			this->groupBox1->TabStop = false;
			this->groupBox1->Text = S"Image";
			// 
			// updatePathName
			// 
			this->updatePathName->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right);
			this->updatePathName->Location = System::Drawing::Point(336, 480);
			this->updatePathName->Name = S"updatePathName";
			this->updatePathName->Size = System::Drawing::Size(120, 24);
			this->updatePathName->TabIndex = 14;
			this->updatePathName->Text = S"Update Path";
			this->updatePathName->Click += new System::EventHandler(this, updatePathName_Click);
			// 
			// pathName
			// 
			this->pathName->Anchor = (System::Windows::Forms::AnchorStyles)((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right);
			this->pathName->Location = System::Drawing::Point(8, 480);
			this->pathName->Name = S"pathName";
			this->pathName->Size = System::Drawing::Size(320, 22);
			this->pathName->TabIndex = 13;
			this->pathName->Text = S"";
			// 
			// AniGroupBox
			// 
			this->AniGroupBox->Anchor = (System::Windows::Forms::AnchorStyles)((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
				| System::Windows::Forms::AnchorStyles::Right);
			this->AniGroupBox->Controls->Add(this->Preview);
			this->AniGroupBox->Controls->Add(this->AniList);
			this->AniGroupBox->Controls->Add(this->AddAni);
			this->AniGroupBox->Location = System::Drawing::Point(640, 24);
			this->AniGroupBox->Name = S"AniGroupBox";
			this->AniGroupBox->Size = System::Drawing::Size(144, 513);
			this->AniGroupBox->TabIndex = 15;
			this->AniGroupBox->TabStop = false;
			this->AniGroupBox->Text = S"Animations";
			// 
			// Preview
			// 
			this->Preview->Anchor = System::Windows::Forms::AnchorStyles::Bottom;
			this->Preview->Location = System::Drawing::Point(8, 481);
			this->Preview->Name = S"Preview";
			this->Preview->Size = System::Drawing::Size(120, 24);
			this->Preview->TabIndex = 10;
			this->Preview->Text = S"Preview";
			this->Preview->Click += new System::EventHandler(this, Preview_Click);
			// 
			// FrameGroupBox
			// 
			this->FrameGroupBox->Anchor = (System::Windows::Forms::AnchorStyles)((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
				| System::Windows::Forms::AnchorStyles::Right);
			this->FrameGroupBox->Controls->Add(this->UpdateFrame);
			this->FrameGroupBox->Controls->Add(this->FrameList);
			this->FrameGroupBox->Controls->Add(this->AddFrame);
			this->FrameGroupBox->Controls->Add(this->groupBox4);
			this->FrameGroupBox->Location = System::Drawing::Point(488, 24);
			this->FrameGroupBox->Name = S"FrameGroupBox";
			this->FrameGroupBox->Size = System::Drawing::Size(144, 513);
			this->FrameGroupBox->TabIndex = 16;
			this->FrameGroupBox->TabStop = false;
			this->FrameGroupBox->Text = S"Frames";
			// 
			// UpdateFrame
			// 
			this->UpdateFrame->Anchor = System::Windows::Forms::AnchorStyles::Bottom;
			this->UpdateFrame->Location = System::Drawing::Point(8, 425);
			this->UpdateFrame->Name = S"UpdateFrame";
			this->UpdateFrame->Size = System::Drawing::Size(120, 24);
			this->UpdateFrame->TabIndex = 10;
			this->UpdateFrame->Text = S"Update Frame";
			this->UpdateFrame->Click += new System::EventHandler(this, UpdateFrame_Click);
			// 
			// groupBox4
			// 
			this->groupBox4->Anchor = System::Windows::Forms::AnchorStyles::Bottom;
			this->groupBox4->Controls->Add(this->frameDelay);
			this->groupBox4->Location = System::Drawing::Point(8, 449);
			this->groupBox4->Name = S"groupBox4";
			this->groupBox4->Size = System::Drawing::Size(128, 56);
			this->groupBox4->TabIndex = 11;
			this->groupBox4->TabStop = false;
			this->groupBox4->Text = S"Frame Delay";
			// 
			// frameDelay
			// 
			System::Int32 __mcTemp__8[] = new System::Int32[4];
			__mcTemp__8[0] = 50;
			__mcTemp__8[1] = 0;
			__mcTemp__8[2] = 0;
			__mcTemp__8[3] = 0;
			this->frameDelay->Increment = System::Decimal(__mcTemp__8);
			this->frameDelay->Location = System::Drawing::Point(8, 24);
			System::Int32 __mcTemp__9[] = new System::Int32[4];
			__mcTemp__9[0] = 10000;
			__mcTemp__9[1] = 0;
			__mcTemp__9[2] = 0;
			__mcTemp__9[3] = 0;
			this->frameDelay->Maximum = System::Decimal(__mcTemp__9);
			this->frameDelay->Name = S"frameDelay";
			this->frameDelay->RightToLeft = System::Windows::Forms::RightToLeft::No;
			this->frameDelay->Size = System::Drawing::Size(112, 22);
			this->frameDelay->TabIndex = 9;
			this->frameDelay->ThousandsSeparator = true;
			System::Int32 __mcTemp__10[] = new System::Int32[4];
			__mcTemp__10[0] = 100;
			__mcTemp__10[1] = 0;
			__mcTemp__10[2] = 0;
			__mcTemp__10[3] = 0;
			this->frameDelay->Value = System::Decimal(__mcTemp__10);
			// 
			// Form1
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 15);
			this->ClientSize = System::Drawing::Size(794, 551);
			this->Controls->Add(this->FrameGroupBox);
			this->Controls->Add(this->AniGroupBox);
			this->Controls->Add(this->groupBox1);
			this->Controls->Add(this->toolBar1);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->label1);
			this->Icon = (__try_cast<System::Drawing::Icon *  >(resources->GetObject(S"$this.Icon")));
			this->KeyPreview = true;
			this->Menu = this->mainMenu1;
			this->MinimumSize = System::Drawing::Size(802, 550);
			this->Name = S"Form1";
			this->Text = S"TGN Editor";
			this->KeyDown += new System::Windows::Forms::KeyEventHandler(this, Form1_KeyDown);
			this->SizeChanged += new System::EventHandler(this, Form1_SizeChanged);
			this->KeyPress += new System::Windows::Forms::KeyPressEventHandler(this, Form1_KeyPress);
			this->KeyUp += new System::Windows::Forms::KeyEventHandler(this, Form1_KeyUp);
			this->ImagePanel->ResumeLayout(false);
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->mainID))->EndInit();
			this->groupBox1->ResumeLayout(false);
			this->AniGroupBox->ResumeLayout(false);
			this->FrameGroupBox->ResumeLayout(false);
			this->groupBox4->ResumeLayout(false);
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->frameDelay))->EndInit();
			this->ResumeLayout(false);

		}	

int GetAPProperties(int ID, int nextID, int boundw, int boundh, char *name)
{
	if(AniList->SelectedIndex < 0 || AniList->SelectedIndex > 19)
		return 0;

	/*file->SetAni(AniList->SelectedIndex, ID, nextID, boundw, boundh, name);

	AniList->Items->Add(S"Animation");*/

	return 1;
}

void needsSave(bool needs)
{
	if(needs && !needSave)
	{
		needSave = true;
		this->Text = String::Concat(this->Text, "*");
	}
	else if(!needs)
	{
		needSave = false;
		this->Text = String::Concat("Trygon Editor - ", currentFile);
	}
}

#include "src/StringFun.h"
#include "src/ImageBox.h"
#include "src/FrameList.h"
#include "src/FrameContext.h"
#include "src/AniList.h"
#include "src/AniContext.h"
#include "src/MainMenu.h"
#include "src/AniListDragging.h"

#include "FrameObject.h"
#include "AnimObject.h"

private: System::Void Preview_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 if(AniList->SelectedIndex < 0)
				 return;

			 if(file->GetImageName() == NULL)
				 return;

		 }

private: System::Void Form1_KeyDown(System::Object *  sender, System::Windows::Forms::KeyEventArgs *  e)
		 {
			 if(e->Control)
				 ctrlDown = true;
		 }

private: System::Void Form1_KeyUp(System::Object *  sender, System::Windows::Forms::KeyEventArgs *  e)
		 {
			 if(!e->Control)
				 ctrlDown = false;
		 }
};
}


